<!DOCTYPE html>
<html>
<head>
    <title>{$name} {$seo_title} {$site_name}</title>
    <meta name="keywords" content="{$seo_keywords}" />
    <meta name="description" content="{$seo_description}">
    <tc_include file="Public:head" />
</head>
<body>
    <tc_include file="Public:nav" />
    <php>
        $home_slides=sp_getslide("portal_index");

        $home_slides=empty($home_slides)?$default_home_slides:$home_slides;
    </php>

    
    <div class="container">
        <ul id="homeslider" class="unstyled">
            <foreach name="home_slides" item="vo">
                <li>
                    <a href="{$vo.slide_url}"><img src="{:sp_get_asset_upload_path($vo['slide_pic'])}" alt=""></a>
                </li>
            </foreach>
        </ul>
        <intput id="hid_select" title="{$name}" type="hidden"></intput>
        <div class="tc-box">
            <php>
                $last_terms=sp_get_terms("field:*;limit:0,8;order:term_id ;where:parent = $par_id;");
            </php>
            <div class="fontmsyhbd" style="font-size:20px;float:left;margin-top:10px;">所属行业：</div>            
            <ul id="ui_content" class="list-unstyled tc-photos margin-bottom-30" style="margin:5px 0px">
                <li>
                    <a id="li_quanbu" style="background-color:#ffffff;color:#000000;font-size:20px;border-width:0px"  href="{:leuu('list/index',array('id'=>$par_id,'pid'=>$par_id))}">全部</a>
                </li>
                <foreach name="last_terms" item="vo">
                    <li>
                        <a  value="{$vo.name}" style="background-color:#ffffff;color:#000000;font-size:20px;border-width:0px" href="{:leuu('list/index',array('id'=>$vo['term_id'],'pid'=>$vo['parent']))}">{$vo.name}</a>
                    </li>
                </foreach>
            </ul>
        </div>
        <php> $lists = sp_sql_posts_paged("cid:$cat_id;order:istop DESC, post_date DESC;",5); </php>
        <div id="container">
            <div class="grid-sizer"></div>
            <volist name="lists['posts']" id="vo">
                <php>
                    $smeta=json_decode($vo['smeta'], true);
                    $postdate=time_format($vo['post_date']);
                </php>
                <div class="item">
                    <div class="tc-gridbox">
                        <div class="header">
                            <if condition="!empty($smeta['thumb'])">
                                <div class="item-image">
                                    <a href="{:leuu('article/index',array('id'=>$vo['object_id'],'cid'=>$vo['term_id']))}">
                                        <img src="{:sp_get_asset_upload_path($smeta['thumb'])}" style="width:100%; height:100%"
                                             class="img-responsive" alt="{$vo.post_title}">
                                    </a>
                                </div>
                                <else />
                            </if>
                            <div style="height: 30px;margin-top: 3px">
                                <p class="fontmsyhbd" style="float: left;font-size: 14px;line-height:25px;width:65%; text-align:left;max-height:50px;min-height:50px;padding-left:5px;">
                                    <a href="{:leuu('article/index',array('id'=>$vo['object_id'],'cid'=>$vo['term_id']))}">{$vo.post_title}</a>
                                </p>
                                <a href="{:leuu('article/index',array('id'=>$vo['object_id'],'cid'=>$vo['term_id']))}"><div style="line-height: 25px;float:right; border-radius: 10px;background-color: #C8161d;color: #ffffff;text-align: center;width: 75px;height: 25px;font-size: 12px;margin-right:4px;">查看更多</div></a>
                            </div>
                        </div>
                    
                        <div class="body" style="clear:both">
                            <div style="border-top: dashed 1px #AEAEAE;height:1px"></div>
                            <a href="{:leuu('article/index',array('id'=>$vo['object_id'],'cid'=>$vo['term_id']))}"><span style="font-size: 11px;color: #686568;">{$vo.post_excerpt|msubstr=0,55}</span></a>
                        </div>
                        <div class="footer">
                           
                            <div class="pull-right">
                                 <span class="meta" style="font-size:11px;color:#AEAEAE">{$postdate}</span>
                            </div>
                            <div class="clearfix" ></div>
                        </div>
                    </div>
                </div>
            </volist>
        </div>
        <!-- <div class="pagination"><ul>{$lists['page']}</ul></div> -->
        <div class="js-infinite-scroll-loading text-center" style="display: none;">正在加载...</div>
        <div id="nextpage"></div>
        
    </div>
    <tc_include file="Public:footer" />
    <!-- JavaScript -->
    <tc_include file="Public:scripts" />
    <script src="__TMPL__Public/assets/js/imagesloaded.pkgd.min.js"></script>
    <script src="__TMPL__Public/assets/js/masonry.pkgd.min.js"></script>
    <script src="__TMPL__Public/assets/js/jquery.infiniteScroll.js"></script>
    <script>

        $(function(){

            var isloadquanbu=false;
            $("#ui_content").find('a').each(function () {
                if ( $("#hid_select").attr("title")==$(this).text()) {
                    $(this).css("color","#FFFFFF");
                    $(this).css("background-color","#C8161D");                    
                    isloadquanbu=true;
                }
            });
            if (!isloadquanbu) {
                $("#li_quanbu").css("color","#FFFFFF");
                $("#li_quanbu").css("background-color","#C8161D");  
            };
            var $container= $('#container').masonry({
                columnWidth : '.grid-sizer',
                itemSelector : '.item'
            });

            $container.imagesLoaded().progress(function (imgLoad, image) {
                var msnry = $container.data('masonry');
                var itemSelector = msnry.options.itemSelector;
                var $item = $(image.img).parents(itemSelector);
                $('.tc-gridbox',$item).css('opacity',1);
                msnry.layout();
            });

            $('#nextpage').infiniteScroll({
                loading:'.js-infinite-scroll-loading',
                total_pages:{$lists['total_pages']},
                success:function(content){
                    var $items=$(content).find('#container .item');
                    if($items.length>0){
                        //$('.tc-gridbox',$items).css('opacity',1);
                        $container.append( $items )
					    // add and layout newly prepended items
					    .masonry( 'appended', $items );
                        $items.imagesLoaded().progress(function (imgLoad, image) {
                            var msnry = $container.data('masonry');
                            var itemSelector = msnry.options.itemSelector;
                            var $item = $(image.img).parents(itemSelector);
                            $('.tc-gridbox',$item).css('opacity',1);
                            msnry.layout();
                        });
                    }
                },
                finish:function(){

                }
            });
        });




    </script>
</body>
</html>